﻿using Efficient.Domain;

namespace Efficient.DataAccess
{
    public class Keyword : ValueType<Keyword>
    {
        private readonly string keywordParam;
        private readonly KeyMode matchMode = KeyMode.Contain;

        public Keyword(string keywordParam, KeyMode matchMode)
        {
            this.keywordParam = keywordParam;
            this.matchMode = matchMode;
        }

        public string KeywordParam
        {
            get { return keywordParam; }
        }

        public KeyMode MatchMode
        {
            get { return matchMode; }
        }

        public override int GetHashCode()
        {
            return this.keywordParam.GetHashCode() * 33;
        }

        protected override bool BusinessEquals(Keyword entity)
        {
            return this.keywordParam.Equals(entity.keywordParam, System.StringComparison.OrdinalIgnoreCase);
        }

        public override int CompareTo(Keyword other)
        {
            return this.keywordParam.CompareTo(other.keywordParam);
        }
    }
}